<template>
  <div>
    <el-container style="margin-top: -45px">
      <el-main>
        <h4>基础信息</h4>
        <el-button
          style="float: right; margin-top: -40px"
          size="small"
          v-if="!editinfo"
          @click="updatauserinfo"
          type="primary"
          >保存</el-button
        >
        <el-descriptions class="margin-top" :column="1" border>
          <el-descriptions-item
            label="工号"
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
       
              工号
            </template>
            {{ form.id }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
          
              姓名
            </template>
            {{ form.name }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
            
              性别
            </template>
            {{ form.sex }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
        
              主部门
            </template>

            <el-select
              v-model="form.depid"
              placeholder="请选择"
              style="width: 100%"
              filterable
              disabled=true
            >
              <el-option
                v-for="item in selectdepartment"
                :key="item.id"
                :label="item.label"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
        
              岗位
            </template>
            {{ form.post }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
           
              层级
            </template>
            {{ form.posttype }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
           
              职级
            </template>
            {{ form.postclass }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
      
              年龄
            </template>
            {{ form.age }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
         
              手机
            </template>
            {{ form.mobile }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
         
              政治面貌
            </template>
            {{ form.political }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
              
              籍贯
            </template>
            {{ form.jiguan }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
         
              特长爱好
            </template>
            {{ form.hobby }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
            
              民族
            </template>
            {{ form.nation }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
     
              身份证号
            </template>
            {{ form.idcardnum }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
        
              血型
            </template>
            {{ form.blood }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
              
              工作场所
            </template>
            {{ form.workplace }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
          
              身高
            </template>
            {{ form.tall }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
     
              婚否
            </template>
            {{ form.marry }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
      
              个人邮箱
            </template>
            {{ form.email }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">

              合同种类
            </template>
            {{ form.contract_type }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
        
              合同主体
            </template>
            {{ form.contract_body }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
        
              合同期限
            </template>
            {{ form.contract_long }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
  
              签订日期
            </template>
            {{ form.contract_start }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
   
              结束日期
            </template>

            {{ form.contract_end }}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
      
              工作日期
            </template>
            {{form.workdate}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
        
              入职日期
            </template>
            {{form.employdate}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">

              转正日期
            </template>
            {{form.inductiondate}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
     
              体重
            </template>
            {{form.weight}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
   
              职称
            </template>
            {{form.title}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
       
              社保缴纳
            </template>
            {{form.isss}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
  
              职业资格
            </template>
            {{form.pq}}        
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
   
              身份证住址
            </template>
            {{form.idcardaddress}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
              通讯地址
            </template>
            {{form.address}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
              紧急联系人
            </template>
            {{form.ecname}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">

              关系
            </template>
            {{form.ec}}
          </el-descriptions-item>

          <el-descriptions-item
            :contentStyle="{ 'text-align': 'center' }"
            :labelStyle="{ 'text-align': 'center' }"
          >
            <template slot="label">
              联系方式
            </template>
            {{form.ecmobile}}
          </el-descriptions-item>

        </el-descriptions>

        <h4>家庭情况</h4>
        <el-button
          v-if="!editinfo"
          icon="el-icon-plus"
          size="mini"
          @click="addfamily"
        ></el-button>

        <el-table
          :data="family"
          border
          style="width: 100%"
          :header-cell-style="{
            background: '#fafafa',
            color: '#979b9f',
            fontWeight: 'normal',
          }"
        >
          <el-table-column
            prop="name"
            label="姓名"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="relationship"
            label="关系"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="company"
            label="工作机构"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="post"
            label="职务"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="mobile"
            label="联系电话"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            fixed="right"
            label="操作"
            v-if="!editinfo"
            width="100"
          >
            <template slot-scope="scope">
              <el-button @click="editfamily(scope.row)" type="text" size="small"
                >编辑</el-button
              >
              <el-button
                type="text"
                size="small"
                @click="deletefamily(scope.$index, scope.row)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <h4>教育经历（从最高学历开始填写）</h4>
        <el-button
          v-if="!editinfo"
          icon="el-icon-plus"
          size="mini"
          @click="addedu"
        ></el-button>

        <el-table
          :data="eduexp"
          border
          style="width: 100%"
          :header-cell-style="{
            background: '#fafafa',
            color: '#979b9f',
            fontWeight: 'normal',
          }"
        >
          <el-table-column
            prop="education"
            label="学历层次"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="educationtype"
            label="学历类型"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="educationsn"
            label="学历证书编号"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="degree"
            label="学位层次"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="degreesn"
            label="学位证书编号"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="stime"
            label="入学时间"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="etime"
            label="毕业时间"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="name"
            label="学校名称"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="major"
            label="专业"
            header-align="center"
            align="center"
          >
          </el-table-column>

          <el-table-column
            fixed="right"
            label="操作"
            width="100"
            v-if="!editinfo"
          >
            <template slot-scope="scope">
              <el-button @click="editedu(scope.row)" type="text" size="small"
                >编辑</el-button
              >
              <el-button
                type="text"
                size="small"
                @click="deleteedu(scope.$index, scope.row)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <h4>工作经历</h4>
        <el-button
          v-if="!editinfo"
          icon="el-icon-plus"
          size="mini"
          @click="addwork"
        ></el-button>
        <el-table
          :data="workexp"
          border
          style="width: 100%"
          :header-cell-style="{
            background: '#fafafa',
            color: '#979b9f',
            fontWeight: 'normal',
          }"
        >
          <el-table-column
            prop="stime"
            label="入职时间"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="etime"
            label="离职时间"
            header-align="center"
            align="center"
          >
            <template slot-scope="{ row }">
              {{ row.etime == "1000-01-01" ? "至今" : row.etime }}
            </template>
          </el-table-column>

          <el-table-column
            prop="name"
            label="公司名称"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="post"
            label="职位"
            header-align="center"
            align="center"
          >
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            width="100"
            v-if="!editinfo"
          >
            <template slot-scope="scope">
              <el-button @click="editwork(scope.row)" type="text" size="small"
                >编辑</el-button
              >
              <el-button
                type="text"
                size="small"
                @click="deletework(scope.$index, scope.row)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </el-main>
    </el-container>

    <el-dialog
      title="教育经历"
      :visible.sync="eduaddcard"
      width="60%"
      left
      :append-to-body="true"
    >
      <el-form ref="form" :model="form" label-width="100px">
        <el-form-item label="学历层次">
          <el-select
            v-model="eduform.education"
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option label="博士研究生" value="博士研究生"></el-option>
            <el-option label="硕士研究生" value="硕士研究生"></el-option>
            <el-option label="大学本科" value="大学本科"></el-option>
            <el-option label="大学专科" value="大学专科"></el-option>
            <el-option label="中等专科" value="中等专科"></el-option>
            <el-option label="职业高中" value="职业高中"></el-option>
            <el-option label="技工学校" value="技工学校"></el-option>
            <el-option label="普通高中" value="普通高中"></el-option>
            <el-option label="初中" value="初中"></el-option>
            <el-option label="小学" value="小学"></el-option>
            <el-option label="其他" value="其他"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item
          label="学历类型"
          v-if="
            eduform.education == '博士研究生' ||
            eduform.education == '硕士研究生' ||
            eduform.education == '大学本科' ||
            eduform.education == '大学专科'
          "
        >
          <el-select
            v-model="eduform.educationtype"
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option
              label="普通高等教育（统招）"
              value="普通高等教育（统招）"
            ></el-option>
            <el-option
              label="普通专升本（统招）"
              value="普通专升本（统招）"
            ></el-option>
            <el-option label="成人高考" value="成人高考"></el-option>
            <el-option label="自考" value="自考"></el-option>
            <el-option label="电大" value="电大"></el-option>
            <el-option
              label="网络教育（远程教育）"
              value="网络教育（远程教育）"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item
          label="学历证书编号"
          v-if="
            eduform.education == '博士研究生' ||
            eduform.education == '硕士研究生' ||
            eduform.education == '大学本科' ||
            eduform.education == '大学专科'
          "
        >
          <el-input
            v-model="eduform.educationsn"
            style="width: 100%"
          ></el-input>
        </el-form-item>

        <el-form-item
          label="学位层次"
          v-if="
            eduform.education == '博士研究生' ||
            eduform.education == '硕士研究生' ||
            eduform.education == '大学本科' ||
            eduform.education == '大学专科'
          "
        >
          <el-select
            v-model="eduform.degree"
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option label="学士" value="学士"></el-option>
            <el-option label="双学士" value="双学士"></el-option>
            <el-option label="第二学士" value="第二学士"></el-option>
            <el-option label="硕士" value="硕士"></el-option>
            <el-option label="博士" value="博士"></el-option>
            <el-option label="名誉博士" value="名誉博士"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item
          label="学位证书编号"
          v-if="
            eduform.education == '博士研究生' ||
            eduform.education == '硕士研究生' ||
            eduform.education == '大学本科' ||
            eduform.education == '大学专科'
          "
        >
          <el-input v-model="eduform.degreesn"></el-input>
        </el-form-item>

        <el-form-item label="学校名称">
          <el-input v-model="eduform.name" style="width: 100%"></el-input>
        </el-form-item>

        <el-form-item label="入学时间">
          <el-date-picker
            type="date"
            placeholder="选择入学时间"
            v-model="eduform.stime"
            style="width: 100%"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>

        <el-form-item label="毕业时间">
          <el-date-picker
            type="date"
            placeholder="选择毕业时间"
            v-model="eduform.etime"
            style="width: 100%"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>

        <el-form-item
          label="专业"
          v-if="
            eduform.education == '博士研究生' ||
            eduform.education == '硕士研究生' ||
            eduform.education == '大学本科' ||
            eduform.education == '大学专科' ||
            eduform.education == '中等专科' ||
            eduform.education == '职业高中' ||
            eduform.education == '技工学校'
          "
        >
          <el-input v-model="eduform.major"></el-input>
        </el-form-item>

        <el-form-item v-if="isadd">
          <el-button type="primary" @click="postedu(0)" style="width: 100%"
            >新增</el-button
          >
        </el-form-item>

        <el-form-item v-if="!isadd">
          <el-button type="primary" @click="postedu(1)" style="width: 100%"
            >修改</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      title="工作经历"
      :visible.sync="workaddcard"
      width="60%"
      left
      :append-to-body="true"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="入职时间">
          <el-date-picker
            type="date"
            placeholder="选择入职日期"
            v-model="workform.stime"
            style="width: 100%"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>

        <el-form-item label="离职时间">
          <el-date-picker
            type="date"
            placeholder="选择离职日期，至今无需填写"
            v-model="workform.etime"
            style="width: 100%"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>

        <el-form-item label="公司名称">
          <el-input v-model="workform.name"></el-input>
        </el-form-item>

        <el-form-item label="职位">
          <el-input v-model="workform.post"></el-input>
        </el-form-item>

        <el-form-item v-if="isadd">
          <el-button type="primary" @click="postwork(0)" style="width: 100%"
            >新增</el-button
          >
        </el-form-item>

        <el-form-item v-if="!isadd">
          <el-button type="primary" @click="postwork(1)" style="width: 100%"
            >修改</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      title="家庭成员"
      :visible.sync="familycard"
      width="60%"
      :append-to-body="true"
      left
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="关系">
          <el-select
            v-model="familyform.relationship"
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option label="父亲" value="父亲"></el-option>
            <el-option label="母亲" value="母亲"></el-option>
            <el-option label="丈夫" value="丈夫"></el-option>
            <el-option label="妻子" value="妻子"></el-option>
            <el-option label="儿子" value="儿子"></el-option>
            <el-option label="女儿" value="女儿"></el-option>
            <el-option label="兄弟" value="兄弟"></el-option>
            <el-option label="姐妹" value="姐妹"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="姓名">
          <el-input v-model="familyform.name"></el-input>
        </el-form-item>

        <el-form-item label="工作机构">
          <el-input v-model="familyform.company"></el-input>
        </el-form-item>

        <el-form-item label="职务">
          <el-input v-model="familyform.post"></el-input>
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="familyform.mobile"></el-input>
        </el-form-item>

        <el-form-item v-if="isadd">
          <el-button type="primary" @click="postfamily(0)" style="width: 100%"
            >新增</el-button
          >
        </el-form-item>

        <el-form-item v-if="!isadd">
          <el-button type="primary" @click="postfamily(1)" style="width: 100%"
            >修改</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: [
    "form",
    "eduexp",
    "workexp",
    "editinfo",
    "type",
    "dingtalkdeplist",
    "family",
  ],

  created() {
    this.getpost();
    this.getDepartment();
  },

  data() {
    return {
      selectpost: [],
      selectdepartment: [],

      eduaddcard: false,
      workaddcard: false,
      familycard: false,
      isadd: false,

      eduaddcard: false,
      workaddcard: false,

      familyform: {
        id: "",
        relationship: "",
        company: "",
        post: "",
        mobile: "",
      },

      eduform: {
        id: "",
        stime: null,
        etime: null,
        name: "",
        major: "",
        degree: "",
      },
      workform: { id: "", stime: null, etime: null, name: "", post: "" },
    };
  },
  methods: {
    async getDepartment() {
      try {
        let res = await this.$axios.get(`api/member/getdepartment`);
        this.selectdepartment = res.data;
      } catch (e) {}
    },

    async getpost() {
      this.$axios
        .post("api/member/getpost")
        .then((response) => {
          this.selectpost = response.data;
        })

        .catch(function (error) {
          console.log(error);
        });
    },

    // async getUserDetail(row) {
    //   let id = row.id;
    //   try {
    //     let res = await this.$axios.get(`api/member/getuserdetail?id=` + id);
    //     this.form = res.data.member[0];
    //     this.eduexp = res.data.eduexp;
    //     this.workexp = res.data.workexp;
    //     this.dingtalkdeplist=res.data.dingtalkdeplist;
    //     console.log(res.data)

    //   } catch (e) {}
    // },

    addfamily() {
      this.familycard = true;
      this.isadd = true;
      this.familyform = [];
    },

    editfamily(row) {
      this.familycard = true;
      this.isadd = false;
      this.familyform = row;
    },

    addedu() {
      this.eduaddcard = true;
      this.isadd = true;
      this.eduform = [];
    },

    editedu(row) {
      this.eduaddcard = true;
      this.isadd = false;
      this.eduform = row;
    },

    addwork() {
      this.workaddcard = true;
      this.isadd = true;
      this.workform = [];
    },

    editwork(row) {
      this.workaddcard = true;
      this.isadd = false;
      this.workform = row;
    },

    async postfamily(type) {
      let datas = {
        type: type,
        userid: this.form.id,
        id: this.familyform.id,
        relationship: this.familyform.relationship,
        name: this.familyform.name,
        company: this.familyform.company,
        post: this.familyform.post,
        mobile: this.familyform.mobile,
      };
      this.$axios
        .post("api/member/postfamily", datas)
        .then((response) => {
          this.$message({
            message: response.data.msg,
            type: "success",
          });
          if (response.data.msg == "家庭成员添加成功") {
            this.family.push({
              id: response.data.id,
              name: datas.name,
              relationship: datas.relationship,
              company: datas.company,
              mobile: datas.mobile,
              post: datas.post,
            });
          }
          this.familycard = false;
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async postedu(type) {
      let datas = {
        type: type,
        userid: this.form.id,
        id: this.eduform.id,
        name: this.eduform.name,
        stime: this.eduform.stime,
        etime: this.eduform.etime,
        degree: this.eduform.degree,
        major: this.eduform.major,
        education: this.eduform.education,
        educationtype: this.eduform.educationtype,
        educationsn: this.eduform.educationsn,
        degreesn: this.eduform.degreesn,
      };
      this.$axios
        .post("api/member/postedu", datas)
        .then((response) => {
          this.$message({
            message: response.data.msg,
            type: "success",
          });
          if (response.data.msg == "教育经历添加成功") {
            this.eduexp.push({
              id: response.data.id,
              stime: datas.stime,
              etime: datas.etime,
              name: datas.name,
              major: datas.major,
              degree: datas.degree,
              education: datas.education,
              educationtype: datas.educationtype,
              educationsn: datas.educationsn,
              degreesn: datas.degreesn,
            });
          }
          this.eduaddcard = false;
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async postwork(type) {
      let datas = {
        type: type,
        id: this.workform.id,
        userid: this.form.id,
        name: this.workform.name,
        stime: this.workform.stime,
        etime: this.workform.etime,
        post: this.workform.post,
      };
      this.$axios
        .post("api/member/postwork", datas)
        .then((response) => {
          this.$message({
            message: response.data.msg,
            type: "success",
          });
          if (response.data.msg == "工作经历添加成功") {
            this.workexp.push({
              id: response.data.id,
              stime: datas.stime,
              etime: datas.etime,
              name: datas.name,
              post: datas.post,
            });
          }
          this.workaddcard = false;
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async deleteedu(index, row) {
      this.$confirm("是删除该条信息？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let datas = {
            id: row.id,
            userid: this.userid,
            postername: sessionStorage.getItem("name"),
          };
          this.$axios
            .post("api/member/deleteedu", datas)
            .then((response) => {
              this.$message({
                message: response.data.msg,
                type: "success",
              });
              this.eduexp.splice(index, 1);
            })
            .catch(function (error) {
              console.log(error);
            });
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async deletework(index, row) {
      this.$confirm("是删除该条信息？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let datas = {
            id: row.id,
            userid: this.userid,
            postername: sessionStorage.getItem("name"),
          };
          this.$axios
            .post("api/member/deletework", datas)
            .then((response) => {
              this.$message({
                message: response.data.msg,
                type: "success",
              });
              this.workexp.splice(index, 1);
            })
            .catch(function (error) {
              console.log(error);
            });
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async deletefamily(index, row) {
      this.$confirm("是删除该条信息？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let datas = {
            id: row.id,
            userid: this.userid,
            postername: sessionStorage.getItem("name"),
          };
          this.$axios
            .post("api/member/deletefamily", datas)
            .then((response) => {
              this.$message({
                message: response.data.msg,
                type: "success",
              });
              this.family.splice(index, 1);
            })
            .catch(function (error) {
              console.log(error);
            });
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async deleteedu(index, row) {
      this.$confirm("是删除该条信息？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let datas = {
            id: row.id,
            userid: this.form.id,
            postername: sessionStorage.getItem("name"),
          };
          this.$axios
            .post("api/member/deleteedu", datas)
            .then((response) => {
              this.$message({
                message: response.data,
                type: "success",
              });
              this.eduexp.splice(index, 1);
            })
            .catch(function (error) {
              console.log(error);
            });
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async deletework(index, row) {
      this.$confirm("是删除该条信息？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let datas = {
            id: row.id,
            userid: this.form.id,
            postername: sessionStorage.getItem("name"),
          };
          this.$axios
            .post("api/member/deletework", datas)
            .then((response) => {
              this.$message({
                message: response.data,
                type: "success",
              });
              this.workexp.splice(index, 1);
            })
            .catch(function (error) {
              console.log(error);
            });
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    async updatauserinfo() {
      let datas = {
        newdata: this.form,
        type: this.type,
        dingtalkdeplist: this.dingtalkdeplist,
        name: sessionStorage.getItem("name"),
      };
      console.log(this.dingtalkdeplist);
      this.$axios
        .post("api/member/updatauserinfo", datas)
        .then((response) => {
          this.$notify({
            title: "用户信息",
            message: response.data,
            type: "success",
            duration: 1500,
          });
        })
        .catch(function (error) {
          console.log(error);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>